package com.timoon.sample.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.timoon.sample.dao.InfoSortDAO;
import com.timoon.sample.dao.model.InfoSort;
import com.timoon.sample.dao.model.InfoSortExample;
import com.timoon.webcomponent.utility.helpinfo.InfoSortService;
import com.timoon.webcomponent.utility.titlelist.typelist.PasssageTypeListService;

/**
 *<p></p>
 *<p></p>
 *<p>Copyright:Copyright(c)2013</p>
 *<p>Company:timoon</p>
 *@author 付乐天
 *@version 1.0 */

@Service(value="sample.infoSort")
public class InfoSortServiceImpl implements PasssageTypeListService ,InfoSortService{

	@Resource
	private InfoSortDAO infoSortDAOImpl;
	
	@Override
	public List<InfoSort> getInfoSortListByType(final Integer type) {
		// TODO Auto-generated method stub
		return this.infoSortDAOImpl.selectByExample(new InfoSortExample(){{
			this.createCriteria().andTypeEqualTo(type);
		}});
	}

	@Override
	public InfoSort getUniqueInfoSortByType(final Integer type) {
		// TODO Auto-generated method stub
		
		List<InfoSort> infos=this.infoSortDAOImpl.selectByExample(new InfoSortExample(){{
			this.createCriteria().andTypeEqualTo(type);
		}});
		
		if(infos!=null&&infos.size()>0){
			return infos.get(0);
		}
		return null;
	}

}
